package com.daguchuangyi.erp_android.model.account;

import android.text.TextUtils;

import com.daguchuangyi.erp_android.manager.NetworkManager;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/**
 * Created by lijianjian on 2018/3/17.
 */

public class UserInfoModel {
    @SerializedName("user")
    @Expose
    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "UserInfoModel{" +
                "user=" + user +
                '}';
    }

    public static class User {
        @SerializedName("id")
        @Expose
        private int id;
        @SerializedName("name")
        @Expose
        private String name;
        @SerializedName("type")
        @Expose
        private String type;
        @SerializedName("avatar")
        @Expose
        public String avatar;
        @SerializedName("creatorId")
        @Expose
        private int creatorId;
        @SerializedName("creatorName")
        @Expose
        private String creatorName;
        @SerializedName("accountAccess")
        @Expose
        private boolean accountAccess;
        @SerializedName("cadAccess")
        @Expose
        private boolean cadAccess;
        @SerializedName("token")
        @Expose
        private String token;
        @SerializedName("loginErrorNumber")
        @Expose
        private int loginErrorNumber;
        @SerializedName("loginErrorLastAt")
        @Expose
        private String loginErrorLastAt;
        @SerializedName("createLimit")
        @Expose
        private int createLimit;
        @SerializedName("createdAt")
        @Expose
        private String createdAt;
        @SerializedName("updatedAt")
        @Expose
        private String updatedAt;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getAvatar() {
            if (TextUtils.isEmpty(avatar)) {
                return avatar;
            } else {
                return NetworkManager.getInstance().getBaseUrl() + avatar;
            }
        }

        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }

        public int getCreatorId() {
            return creatorId;
        }

        public void setCreatorId(int creatorId) {
            this.creatorId = creatorId;
        }

        public String getCreatorName() {
            return creatorName;
        }

        public void setCreatorName(String creatorName) {
            this.creatorName = creatorName;
        }

        public boolean isAccountAccess() {
            return accountAccess;
        }

        public void setAccountAccess(boolean accountAccess) {
            this.accountAccess = accountAccess;
        }

        public boolean isCadAccess() {
            return cadAccess;
        }

        public void setCadAccess(boolean cadAccess) {
            this.cadAccess = cadAccess;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public int getLoginErrorNumber() {
            return loginErrorNumber;
        }

        public void setLoginErrorNumber(int loginErrorNumber) {
            this.loginErrorNumber = loginErrorNumber;
        }

        public String getLoginErrorLastAt() {
            return loginErrorLastAt;
        }

        public void setLoginErrorLastAt(String loginErrorLastAt) {
            this.loginErrorLastAt = loginErrorLastAt;
        }

        public int getCreateLimit() {
            return createLimit;
        }

        public void setCreateLimit(int createLimit) {
            this.createLimit = createLimit;
        }

        public String getCreatedAt() {
            return createdAt;
        }

        public void setCreatedAt(String createdAt) {
            this.createdAt = createdAt;
        }

        public String getUpdatedAt() {
            return updatedAt;
        }

        public void setUpdatedAt(String updatedAt) {
            this.updatedAt = updatedAt;
        }

        @Override
        public String toString() {
            return "User{" +
                    "id=" + id +
                    ", name='" + name + '\'' +
                    ", type='" + type + '\'' +
                    ", avatar='" + avatar + '\'' +
                    ", creatorId=" + creatorId +
                    ", creatorName='" + creatorName + '\'' +
                    ", accountAccess=" + accountAccess +
                    ", cadAccess=" + cadAccess +
                    ", token='" + token + '\'' +
                    ", loginErrorNumber=" + loginErrorNumber +
                    ", loginErrorLastAt='" + loginErrorLastAt + '\'' +
                    ", createLimit=" + createLimit +
                    ", createdAt='" + createdAt + '\'' +
                    ", updatedAt='" + updatedAt + '\'' +
                    '}';
        }
    }
}
